import requests

#添加员工
url = "http://ihrm2-test.itheima.net/api/sys/user"
header = {"Content-Type":"application/json","Authorization":"Bearer dbb604a5-7aa5-4a22-9bdb-c783113d4b95"}
json_data={
"username":"小猪佩奇",
"mobile":"15100000039",
"workNumber":"9527"
}

resp = requests.post(url,headers=header,json=json_data)
print("添加员工：",resp.json())

#查询员工
url = "http://ihrm2-test.itheima.net/api/sys/user/1469566449784717312"
header_query = {"Content-Type":"application/json","Authorization":"Bearer dbb604a5-7aa5-4a22-9bdb-c783113d4b95"}
resp_query = requests.get(url=url,headers=header_query)
print("查询员工：",resp_query.json())

#修改员工
url = "http://ihrm2-test.itheima.net/api/sys/user/1469566449784717312"
header_modify = {"Content-Type":"application/json","Authorization":"Bearer dbb604a5-7aa5-4a22-9bdb-c783113d4b95"}
json_modify = {"username":"12"}
resp_modify = requests.put(url=url,headers=header_modify,json=json_modify)
print("修改员工：",resp_modify.json())

#删除员工
url = "http://ihrm2-test.itheima.net/api/sys/user/1469566449784717312"
header_delete = {"Content-Type":"application/json","Authorization":"Bearer dbb604a5-7aa5-4a22-9bdb-c783113d4b95"}
resp_delete= requests.delete(url=url,headers=header_delete)
print("删除员工：",resp_delete)



















